perf: reduce tool description token usage by ~69%#11993
perf: reduce tool description token usage by ~69%#11993MartinWie wants to merge 1 commit intoanomalyco:devfrom
Conversation
Condense verbose tool descriptions to reduce system prompt token overhead: - bash.txt: 116 → 53 lines (54% reduction) - Remove verbose quoting examples - Condense git/PR workflows to essential bullet points - Keep all safety rules intact - todowrite.txt: 168 → 32 lines (81% reduction) - Remove 8 verbose examples with reasoning blocks - Keep essential usage criteria and task states - task.txt: 61 → 22 lines (64% reduction) - Remove fictional agent examples - Condense usage notes to bullet points Estimated savings: ~3,000-4,000 tokens per message, which compounds significantly over multi-turn conversations.
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that deal with token optimization and system prompt improvements: Related PRs:
These are related efforts in token optimization and system prompt management, but none appear to be direct duplicates of PR #11993. Your PR is the only one specifically targeting the condensation of the three tool description files (bash.txt, todowrite.txt, task.txt) for token reduction. |
|
Fixes #11995 |
Summary
Condense verbose tool descriptions to reduce system prompt token overhead.
Estimated savings: ~3,000–4,000 tokens per message.
Changes
packages/opencode/src/tool/bash.txt— 116 → 53 linespackages/opencode/src/tool/todowrite.txt— 168 → 32 linespackages/opencode/src/tool/task.txt— 61 → 22 linesRationale
These files are included in the system prompt for every message. Reducing their length significantly cuts per-message token cost without changing tool behavior or removing safety rules.
Testing
bun run build) ✅